function collect_same_elements(collectionA, collectionB) {
  let collectionC=[];
  for (let i=0;i<collectionA.length;i++)
  {  
      for (let j=0;j<collectionB["value"].length;j++)
      if (collectionA[i]["key"]==collectionB["value"][j])
        {collectionC.push(collectionA[i]["key"])}
  }
  return collectionC ;
}

module.exports = collect_same_elements;
